package com.itheima.health.dao;

import com.itheima.health.dto.SetmealCount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface ReportDao {

    Integer countByMonth(Date date);

    @Select("select name from setmeal")
    String[] SelectSetmealNames();

    List<SetmealCount> SelectSetmealInfo();

    @Select("select count(*) from t_order")
    Double countOrder();

    @Select("select remark from setmeal where name =#{name}")
    String SelectSetmealRemark(String name);

    @Select("select count(*) from t_member where regTime =#{date}")
    Integer SelectTodayNewMember(Date date);

    @Select("select count(*) from t_member")
    Integer selectTotalMember();


    Integer SelectThisWeekNewMember(Date firstDay, Date date);

    Integer SelectThisMonthNewMember(Date firstDayOfWeek, Date date);
    @Select("select count(*) from t_order where orderDate =#{date} and orderStatus =#{orderstatusYes}")
    Integer SelectTodayOrderNumber(Date date, String orderstatusYes);

    
    @Select("select count(*) from t_order where orderDate =#{date} and (orderType =#{ordertypeTelephone} or orderType =#{ordertypeWeixin})")
    Integer SelectTodayVisitsNumber(Date date, String ordertypeTelephone, String ordertypeWeixin);

    Integer SelectThisWeekOrderNumber(Date date, Date firstDayOfWeek);

    Integer SelectThisWeekVisitsNumber(Date date, Date firstDayOfWeek, String orderstatusYes);

    Integer SelectThisMonthOrderNumber(Date date, Date firstDay);

    Integer SelectThisMonthVisitsNumber(Date date, Date firstDay, String orderstatusYes);

    @Select("select distinct   setmealId  from t_order")
    Integer[] SelectSetmealId();

    @Select("select count(*) from t_order")
    Integer SelectOrderNumber();

    @Select("select count(*) from t_order where setmealId=#{integer}")
    Integer SelectSetmealNum(Integer integer);
}
